package com.ruoyi.system.service.impl;

import com.ruoyi.common.annotation.DataSource;
import com.ruoyi.common.enums.DataSourceType;
import com.ruoyi.system.domain.MrDeviceAlarmData;
import com.ruoyi.system.mapper.MrDeviceAlarmDataMapper;
import com.ruoyi.system.service.IMrDeviceAlarmData2Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.UUID;

/**
 * 设备报警数据Service业务层处理
 *
 * @author lsw
 * @date 2024-01-03
 */
@Service
@DataSource(value = DataSourceType.SLAVE)
public class MrDeviceAlarmData2ServiceImpl implements IMrDeviceAlarmData2Service
{
    @Autowired
    private MrDeviceAlarmDataMapper mrDeviceAlarmDataMapper;

    /**
     * 查询设备报警数据
     *
     * @param id 设备报警数据主键
     * @return 设备报警数据
     */
    @Override
    public MrDeviceAlarmData selectMrDeviceAlarmDataById(String id)
    {
        return mrDeviceAlarmDataMapper.selectMrDeviceAlarmDataById(id);
    }

    /**
     * 查询设备报警数据列表
     *
     * @param mrDeviceAlarmData 设备报警数据
     * @return 设备报警数据
     */
    @Override
    public List<MrDeviceAlarmData> selectMrDeviceAlarmDataList(MrDeviceAlarmData mrDeviceAlarmData)
    {
        return mrDeviceAlarmDataMapper.selectMrDeviceAlarmDataList(mrDeviceAlarmData);
    }

    /**
     * 新增设备报警数据
     *
     * @param mrDeviceAlarmData 设备报警数据
     * @return 结果
     */
    @Override
    public int insertMrDeviceAlarmData(MrDeviceAlarmData mrDeviceAlarmData)
    {
        mrDeviceAlarmData.setId(UUID.randomUUID().toString());
        return mrDeviceAlarmDataMapper.insertMrDeviceAlarmData(mrDeviceAlarmData);
    }

    /**
     * 修改设备报警数据
     *
     * @param mrDeviceAlarmData 设备报警数据
     * @return 结果
     */
    @Override
    public int updateMrDeviceAlarmData(MrDeviceAlarmData mrDeviceAlarmData)
    {
        return mrDeviceAlarmDataMapper.updateMrDeviceAlarmData(mrDeviceAlarmData);
    }

    /**
     * 批量删除设备报警数据
     *
     * @param ids 需要删除的设备报警数据主键
     * @return 结果
     */
    @Override
    public int deleteMrDeviceAlarmDataByIds(String[] ids)
    {
        return mrDeviceAlarmDataMapper.deleteMrDeviceAlarmDataByIds(ids);
    }

    /**
     * 删除设备报警数据信息
     *
     * @param id 设备报警数据主键
     * @return 结果
     */
    @Override
    public int deleteMrDeviceAlarmDataById(String id)
    {
        return mrDeviceAlarmDataMapper.deleteMrDeviceAlarmDataById(id);
    }

    /**
     * 查询设备报警数据列表
     *
     * @param mrDeviceAlarmData 设备报警数据
     * @return 设备报警数据集合
     */
    @Override
    public List<MrDeviceAlarmData> getDeviceAlarmDataList(MrDeviceAlarmData mrDeviceAlarmData) {
        return mrDeviceAlarmDataMapper.getDeviceAlarmDataList(mrDeviceAlarmData);
    }

    /**
     * 查询当前设备报警数据列表
     *
     * @param mrDeviceAlarmData 设备报警数据
     * @return 当前设备报警数据集合
     */
    @Override
    public List<MrDeviceAlarmData> currentAlarm(MrDeviceAlarmData mrDeviceAlarmData) {
        return mrDeviceAlarmDataMapper.currentAlarm(mrDeviceAlarmData);
    }

    @Override
    public Integer countDeviceAlarm(){
        return mrDeviceAlarmDataMapper.countDeviceAlarm();
    }

    @Override
    public List<MrDeviceAlarmData> selectSyncMrDeviceAlarmDataList(String[] ids) {
        return mrDeviceAlarmDataMapper.selectSyncMrDeviceAlarmDataList(ids);
    }

    @Override
    public void insertBatch(List<MrDeviceAlarmData> records) {
        mrDeviceAlarmDataMapper.insertBatch(records);
    }
}

